package com.iot.custom.page;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @author lzb22
 */
@NoArgsConstructor
@Data
@AllArgsConstructor
public class PageResponseData<T> {
    Long total;
    Long size;
    Long page;
    private Long count;
    private List<T> list;

    public PageResponseData(IPage<T> iPage) {
        this.count = iPage.getSize();
        this.total = iPage.getTotal();
        this.size = iPage.getSize();
        this.page = iPage.getCurrent();
        this.list = iPage.getRecords();
    }
}
